package cn.tedu.submarine;

import javax.swing.*;

//战舰
public class Battleship extends SeaObject {

    private int life;  //命数

    public Battleship(){
        super(66,26,270,124,30);
        life = 5;
    }

    public void move(){
        //暂时搁置
    }

    //返回战舰图片
    public ImageIcon getImage() {
        return Images.battleship;
    }

    //发射炸弹---生成炸弹对象
    public Bomb shootBomb(){
        return new Bomb(this.x,this.y); // 炸弹的起始坐标就是战舰的坐标
    }

    //战舰左移
    public void moveLeft(){
        x -= speed;
    }

    //战舰右移
    public void moveRight(){
        x += speed;
    }

    //战舰增命
    public void addLife(int num){
        life += num; //命数增num
    }

    public int getLife(){
        return life;//返回命数
    }

    //减命
    public void subtractLife(){
        life--;
    }

}